package cn.xbest.rabbitmq.study.controller;

import cn.xbest.rabbitmq.study.service.Sender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mq")
public class RabbitController {

    @Autowired
    private Sender sender;

    //测试消息队列
    @RequestMapping("/out")
    @ResponseBody
    public void mq(){
        sender.send("滚滚长江东逝水");

    }

    @RequestMapping("/direct1")
    @ResponseBody
    public void dmq1(){
        sender.dsend1("我在路由模式发消息1");
    }
    @RequestMapping("/direct2")
    @ResponseBody
    public void dmq2(){
        sender.dsend2("我在路由模式发消息2");
    }

    //测试主题模式
    @RequestMapping("topic1")
    @ResponseBody
    public void tmq1(){
        sender.tsend1("奥特曼战士");
    }
    @RequestMapping("topic2")
    @ResponseBody
    public void tmq2(){
        sender.tsend2("光能攻击");
    }
}
